package com.grt192.ui;

/**
 * 
 * @author nikhil, cody & vikram
 */
public class RealPoint {
        private double x;
        private double y;

        public RealPoint(double x, double y) {
                this.x = x;
                this.y = y;
        }

        public double getX() {
                return x;
        }

        public double getY() {
                return y;
        }

        /**
         * Returns the angle from 0 degrees, the positive x-axis
         */
        public double angleTo(RealPoint p) {
                return Math.toDegrees(Math.atan2(p.getY() - getY(), p.getX() - getX()));
        }

        /**
         * Returns the heading from North
         */
        public double headingTo(RealPoint p) {
                return (360 + 90 - angleTo(p)) % 360;
        }

        public double distanceTo(RealPoint p) {
                return Math.sqrt((Math.pow(p.getX() - this.getX(), 2) + (Math.pow(p
                                .getY()
                                - this.getY(), 2))));
        }
}